﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Smartmanufact
{
    public partial class ADD_Shelf : Form
    {
        public ADD_Shelf()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string name = textBox_shelf_name.Text.Trim();
                int rows = int.Parse(textBox_rows.Text.Trim());
                int cols = int.Parse(textBox_cols.Text.Trim());
                if (name == "") { MessageBox.Show("货架名称不能为空"); }
                if(rows<=0 ||cols<=0)
                {
                    MessageBox.Show("行数与列数不能小于等于0！");
                    return;
                }
                MainView.mysql.excute_sql("insert into entrepotinfo values('"+name+"','"+cols.ToString()+"','"+rows.ToString()+"')");
                this.Dispose();
            }
            catch { }
            
        }
    }
}
